function GridHeader(headerContainerTemplate, grid) {
	this.headerContainerTemplate = headerContainerTemplate;
	this.sortedHeaderCell = null;
	this.sortType = new SortTypes().getDefaultSortType();
	this.grid = grid;
	
	this.headerCells = new Array();
	this.onSort = function(){};
	
	return this;
}

// ------------------------------------------------------------------------------------------------

GridHeader.prototype.addHeaderCell = function(headerCellTemplate, sortDataType){
	var gridHeaderCell = new GridHeaderCell(headerCellTemplate, this, this.headerCells.length, sortDataType);
	var thisGridHeader = this;
	
	gridHeaderCell.onSort = function() {
		thisGridHeader.sortedHeaderCell = gridHeaderCell;
		thisGridHeader.sortedHeaderCell.sortType = thisGridHeader.sortType;
		thisGridHeader.onSort();
	};
	
	this.headerCells.push(gridHeaderCell);
};

//-------------------------------------------------------------------------------------------------

GridHeader.prototype.getHeaderElementOrder = function(headerElement){
	for (var i=0; i<this.headerCells.length; i++){
		alert(this.headerCells[i]==headerElement);
	}
};

//-------------------------------------------------------------------------------------------------

GridHeader.prototype.setSortedHeaderCell = function(sortedHeaderCell){
	this.sortedHeaderCell = sortedHeaderCell;
};

//-------------------------------------------------------------------------------------------------

GridHeader.prototype.getSortedHeaderCell = function(){
	return this.sortedHeaderCell;
};